import { useState } from 'react';
import './index.less';
import '../../public/download/font_4238832_nunxwq8b4n/iconfont.css';
import { history } from 'umi';

export default function IndexPage(props: any) {
  const [activeidx, setActiveidx] = useState(0);
  const navlist = [
    { id: '1', icon: 'icon-shouye', path: '/index/home' },
    { id: '2', icon: 'icon-hei', path: '/index/near' },
    { id: '3', icon: 'icon-INGRESS-GLYPH-TECHNOLOGY-', path: '/index' },
    { id: '4', icon: 'icon--shangpu', path: '/index/dui' },
    { id: '5', icon: 'icon-wode', path: '/index/my' },
  ];
  const goPage = (path: any, idx: any) => {
    history.push(path);
    setActiveidx(idx);
  };
  return (
    <div id="INDEX">
      {props.children}
      <div className="index-nav">
        {navlist.map((item, index) => {
          return (
            <div
              key={item.id}
              className={index === activeidx ? 'navitem2' : 'navitem'}
              onClick={() => {
                goPage(item.path, index);
              }}
            >
              <span className={'iconfont ' + item.icon}></span>
            </div>
          );
        })}
      </div>
    </div>
  );
}
